#include <iostream>
#include <algorithm>
using namespace std;
int s[4];
int a[5][35];
int ans;
int l, r, m;
void dfs(int x, int y) {
    if(x >= s[y]) {
        m = min(m, max(l, r));
        return ;
    }
    l += a[y][x];
    dfs(x + 1, y);
    l -= a[y][x];
    r += a[y][x];
    dfs(x + 1, y);
    r -= a[y][x];
}
int main() {
    cin >> s[0] >> s[1] >> s[2] >> s[3];
    for(int i = 0; i < 4; i++) {
        l = 0;
        r = 0;
        m = 0x3f3f3f3f;
        for(int j = 0; j < s[i]; j++) {
            cin >> a[i][j];
        }
        dfs(0, i);
        ans += m;
    }
    cout << ans;
    return 0;
}